import axios from "axios";

const token = sessionStorage.getItem("authentication");

export const getOrderList = (params: any) =>
    axios({
        url: "api/user/order/historyOrders",
        method: 'get',
        headers: {authentication: token},
        params: params
    })
export const ordersCount = () =>
    axios({
        url: "api/user/order/count",
        method: 'get',
        headers: {authentication: token},
    })

export const reminder = (id: any) =>
    axios({
        url: `api/user/order/reminder/${id}`,
        method: 'get',
        headers: {authentication: token},
    })

export const cancel = (id: any) =>
    axios({
        url: `api/user/order/cancel/${id}`,
        method: 'put',
        headers: {authentication: token},
    })

export const completed = (id: any) =>
    axios({
        url: `api/user/order/completed/${id}`,
        method: 'put',
        headers: {authentication: token},
    })

export const getOrderById = (id: any) =>
    axios({
        url: `api/user/order/getById/${id}`,
        method: 'get',
        headers: {authentication: token},
    })

export const again = (id: any) =>
    axios({
        url: `api/user/order/again/${id}`,
        method: 'post',
        headers: {authentication: token},
    })


export const alipay = (params: any) =>
    axios({
        url: "api/user/order/payment",
        method: 'get',
        headers: {authentication: token},
        params: params
    })

export const insertOrders = (data: any) =>
    axios({
        url: "api/user/order/submit",
        method: 'post',
        headers: {authentication: token},
        data: data
    })
